/**
 * @file Define controllers for all settings handlersPath
 * 
 * @author Steve Gao<gaofu@parllay.com>
 */
const WebBaseController = require('./web-base-controller');
const {SystemServices}  = require('../../constants');

/**
 * The Qiniu Controller
 * 
 * @class QiniuController
 * @extends {WebBaseController}
 */
class QiniuController extends WebBaseController {

    get qiniuService() {
        if (!this._qiniuService) {
            this._qiniuService = this.getSystemService(SystemServices.QINIU_SERVICE);
        }

        return this._qiniuService;
    }

    get name() {
        return 'QiniuController';
    }

    get handlersPath() {
        return 'qiniu';
    }

    /**
     * Request Qiniu Upload token & key with file extension name
     * 
     * @name requestQiniuUptoken
     * @param {String} extName - The file extension name
     * 
     * @returns {String}
     */
    requestQiniuUptoken(extName) {
        return this.qiniuService.requestQiniuUptoken(extName);
    }
}

exports.QiniuController = QiniuController;